﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynamicToolkit
{
    /// <summary>
    /// Wraps example objects
    /// </summary>
    public class Example
    {
        private readonly object exampleObject;
        private readonly bool isAttribute;

        /// <summary>
        /// Contructs an Element example object
        /// </summary>
        /// <param name="exampleObject">The example object</param>
        public Example(object exampleObject)
            : this(exampleObject, false)
        {
        }

        /// <summary>
        /// Constructs an example object.  If <c>isAttribute</c> is <c>false</c>, then constructs an Element example object;
        /// otherwise constructs an Attribute example object
        /// </summary>
        /// <param name="exampleObject">The example object</param>
        /// <param name="isAttribute">If false, then constructs an Element example object;  otherwise constructs an Attribute example object</param>
        protected Example(object exampleObject, bool isAttribute)
        {
            if (exampleObject == null)
            {
                throw new ArgumentNullException("exampleObject", "Example object can't be null.");
            }

            this.exampleObject = exampleObject;
            this.isAttribute = isAttribute;
        }

        /// <summary>
        /// Get the example object
        /// </summary>
        public object ExampleObject
        {
            get { return this.exampleObject; }
        }

        /// <summary>
        /// Get whether the properties of the example object represents elements or attributes.
        /// If <c>true</c> then the wrapped object properties represent attributes, otherwise, they represent elements.
        /// </summary>
        public bool IsAttribute
        {
            get { return isAttribute; }
        }
    }
}
